#ifndef __THREAD_SYNC
#define __THREAD_SYNC
#include "stdint.h"
#include "list.h"
#include "thread.h"

typedef struct {
	int32_t value;
	list waiters;		
}semphore;

typedef struct{
	task_tcb* holder;	
	semphore sem;
	uint32_t repeate_nr;
}lock;

void init_lock(lock* plock);
void init_semphore(semphore* psem,int32_t value);
void sem_down(semphore* psem);
void sem_up(semphore* psem);
void lock_acquire(lock* plock);
void lock_release(lock* plock);

#endif
